package com.poetize.plus.entity.po;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @author zuosy
 * @created 2024/3/28 15:57
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class User {

    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 用户名
     */
    private String username;

    /**
     * 密码
     */
    private String password;

    /**
     * 角色
     */
    private String role;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 性别
     */
    private String gender;

    /**
     * 头像
     */
    private String avatar;

    /**
     * 简介
     */
    private String introduction;

    /**
     * 是否禁用
     */
    private Boolean forbidden;

    /*user表不继承统一的以下五个字段，统一的五个字段是在登录状态插入数据的
    * 而注册时是未登录状态，此时创建人就是注册人
    * */
    private String createBy;

    private LocalDateTime createTime;

    private String updateBy;

    private LocalDateTime updateTime;

    @TableLogic
    private Boolean deleted;


    public User(Long id, String username, String role, String email, String gender, String introduction) {
        this.id = id;
        this.username = username;
        this.role = role;
        this.email = email;
        this.gender = gender;
        this.introduction = introduction;
    }

    public User(Long id, String email, String gender, String avatar, String introduction){
        this.id = id;
        this.email = email;
        this.gender = gender;
        this.avatar = avatar;
        this.introduction = introduction;
    }
}
